#!/bin/bash

WORKDIR=$(cd $(dirname "$0");pwd)
cd $WORKDIR
echo "当前工作目录 : $WORKDIR"

rm -fr dist
mv ../dist .

TAG="v0.0.1"
if [ -n "$1" ]; then
  
  TAG=$1
fi

IMAGENAME=www.registry.it/gvcloud/gvcloud-manager:${TAG}
echo "Build Image : $IMAGENAME"

docker build -t ${IMAGENAME} .

if [ $? -eq 0 ]; then  
    echo "镜像构建成功"
    docker push ${IMAGENAME}
else  
    echo "镜像构建失败"
    exit 1
fi

